<%
Class TForm
    Private cls_sSubmitMethod
    Private cls_aServerVariables

    Private Sub class_Initialize()
        cls_sSubmitMethod="POST"
    End Sub

    Private Sub class_Terminate()
    End Sub

    Public Property Let Method(ByVal a_sMethod)
        cls_sSubmitMethod=UCase(Trim(a_sMethod))
    End Property

    Public Function getInteger(ByVal a_sForm)
        Dim lValue

        getInteger=null
  
        Select Case(cls_sSubmitMethod)
        Case "POST"
            lValue=Trim(Request.Form(a_sForm))
        Case Else
            lValue=Trim(Request.QueryString(a_sForm))
        End Select

'Response.Write("value:" & cls_sSubmitMethod & "<br/>")

       If IsNone(lValue) Then
           Exit Function
       End If

       If Not IsNumeric(lValue) Then
           Exit Function
       End If

       getInteger=Int(lValue)
    End Function

    Public Function getString(ByVal a_sForm)
        Dim sValue

        getString=null
     
        Select Case(cls_sSubmitMethod)
        Case "POST"
            sValue=Trim(Request.Form(a_sForm))
        Case Else
            sValue=Trim(Request.QueryString(a_sForm))
        End Select

       If IsNone(sValue) Then
           Exit Function
       End If

       getString=Replace(sValue,"'","''")
    End Function

    Public Function getDateTime(ByVal a_sForm)
         Dim dValue

        getDateTime=null
      
        Select Case(cls_sSubmitMethod)
        Case "POST"
            dValue=Trim(Request.Form(a_sForm))
        Case Else
            dValue=Trim(Request.QueryString(a_sForm))
        End Select

       If IsNone(dValue) Then
           Exit Function
       End If

       If Not IsDate(dValue) Then
           Exit Function
       End If

       getDateTime=CDate(dValue)
    End Function

    Public Function getBoolean(ByVal a_sForm)
        Dim bValue

        getBoolean=null
      
        Select Case(cls_sSubmitMethod)
        Case "POST"
            bValue=Trim(Request.Form(a_sForm))
        Case Else
            bValue=Trim(Request.QueryString(a_sForm))
        End Select

       If IsNone(bValue) Then
           getBoolean = false
           Exit Function
       End If

       If (bValue Or bValue>0) Then
           getBoolean=true
       Else
           getBoolean=false
       End If
    End Function

    Public Function getVariables(ByVal a_sVarName)
        If Not (cls_aServerVariables) Then
            cls_aServerVariables = Request.ServerVariables()
        End If
    End Function

    Public Function getForm()
        getForm=Request.Form()
    End Function

    Public Function getQueryString()
        getQueryString=Replace(Request.QueryString(),"'","''")
    End Function
End Class
%>
